Skip to content

various safety and correctness improvements#301

Merged
phip1611 merged 10 commits into
mainfrom
improvements
Jun 23, 2026
Merged

various safety and correctness improvements#301
phip1611 merged 10 commits into
mainfrom
improvements

Conversation

@phip1611

Copy link
Copy Markdown
Member

No description provided.

@phip1611 phip1611 changed the title various improvements various safety and correctness improvements Jun 22, 2026
phip1611 added 2 commits June 23, 2026 09:32
Require Header implementors to report the full structure size and
derive payload_len() from it. Validate undersized reports before
building DynSizedStructure values, and use the reported total size for
tag iteration as well.

This makes the reported size the single source of truth. The old shape
spread the invariant across payload_len(), total_size(), and per-type
assertions, which was easy to drift out of sync. With one authoritative
value, the parsing code can validate once and reuse the same size for
construction, iteration, and downstream casts.

Update the concrete header types in multiboot2 and multiboot2-header
to the new contract, and add a regression test for a reported size that
is smaller than the fixed header.

Breaking: Header implementors now provide total_size() instead of
payload_len().

multiboot2*: simplify MaybeDynSize trait for implementors
phip1611 added 5 commits June 23, 2026 10:05
Add precise SAFETY comments end enable clippy enforcement for
safety comments.
Make the RSDP constructors fill in the checksum fields themselves
so callers do not have to pass them in, and keep the builder tests
matched to that API change.

Validation now uses fixed-size slices for RSDP v1 and rejects bogus
v2 lengths before slicing, which removes the previous out-of-bounds
read risk from checksum validation.
@phip1611 phip1611 added this pull request to the merge queue Jun 23, 2026
@phip1611 phip1611 removed this pull request from the merge queue due to a manual request Jun 23, 2026
phip1611 added 3 commits June 23, 2026 10:12
1.85 and 1.86 have a bug in clippy that let CI fail, although the code
is valid.
This bug exists at least in clippy 1.85 and 1.86. 1.87 is fine.
@phip1611 phip1611 enabled auto-merge June 23, 2026 08:14
@phip1611 phip1611 added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit d532fa3 Jun 23, 2026
29 checks passed
@phip1611 phip1611 deleted the improvements branch June 23, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant